#!/usr/bin/env node

const http = require('https'),
  username = process.argv[2];

//格式字符串
const addr = `https://gitee.com/api/v5/users/${username}/repos?type=all&sort=full_name&page=1&per_page=20`;
http.get(addr, (res)=>{
  //res.pipe(process.stdout);
  console.log(` HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  console.log(res.headers);
  console.log();

  let data = '';

  res.on('data',(chunk)=>{
    data += chunk;
  });
  res.on('end',()=>{
    data = JSON.parse(data);
    for(const repos of data){
      console.log(repos.full_name);
    }
  });

  //res.pipe(process.stdout);
});




